#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPropertyAnimation>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QPropertyAnimation *a = new QPropertyAnimation(ui->pushButton,"geometry");
    a->setDuration(4000);
    a->setStartValue(ui->pushButton->geometry());
    a->setEndValue(QRect(200,200,100,50));

    //创建一个动画 curve（曲线）
    QEasingCurve curve;
    curve.setType(QEasingCurve::InOutCubic);
    curve.setAmplitude(1.0);
    curve.setOvershoot(1.7);
    curve.setPeriod(0.3);

    a->setEasingCurve(curve);
    // 设置循环两次
    a->setLoopCount(2);

    a->start();
}

MainWindow::~MainWindow()
{
    delete ui;
}
